<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>lorisplay</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="lorismorph.html" title="lorismorph" />
    <link rel="next" href="loscil.html" title="loscil" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">lorisplay</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="lorismorph.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="loscil.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="lorisplay"></a>
      <div class="titlepage"></div>
      <a id="IndexLorisPlay" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">lorisplay</span>
        </h2>
        <p>lorisplay — renders a stored set of bandwidth-enhanced partials using the method of Bandwidth-Enhanced Additive Synthesis implemented in the Loris software, applying control-rate frequency, amplitude, and bandwidth scaling envelopes.</p>
      </div>
      <div class="refsect1">
        <a id="idp120543392"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ar <span class="command"><strong>lorisplay</strong></span> ireadidx, kfreqenv, kampenv, kbwenv</pre>
      </div>
      <div class="refsect1">
        <a id="idp120545584"></a>
        <h2>Description</h2>
        <p><span class="emphasis"><em>lorisplay</em></span> renders a stored set of
    bandwidth-enhanced partials using the method of Bandwidth-Enhanced
    Additive Synthesis implemented in the Loris software, applying
    control-rate frequency, amplitude, and bandwidth scaling
    envelopes.</p>
      </div>
      <div class="refsect1">
        <a id="idp120547312"></a>
        <h2>Initialization</h2>
        <p><span class="emphasis"><em>istoreidx, ireadidx, isrcidx, itgtidx</em></span> are
    labels that identify a stored set of bandwidth-enhanced
    partials. <span class="emphasis"><em>lorisread</em></span> imports partials from a SDIF file and stores them
    with the integer label istoreidx. <span class="emphasis"><em>lorismorph</em></span> morphs sets of partials
    labeled <span class="emphasis"><em>isrcidx</em></span> and <span class="emphasis"><em>itgtidx</em></span>, and stores the resulting partials with
    the integer label <span class="emphasis"><em>istoreidx</em></span>. <span class="emphasis"><em>lorisplay</em></span> renders the partials stored
    with the label <span class="emphasis"><em>ireadidx</em></span>. The labels are used only at initialization
    time, and may be reused without any cost or benefit in efficiency, and
    without introducing any interaction between instruments or
    instances.</p>
      </div>
      <div class="refsect1">
        <a id="idp120616512"></a>
        <h2>Performance</h2>
        <p><span class="emphasis"><em>lorisplay</em></span> implements signal reconstruction using
    Bandwidth-Enhanced Additive Synthesis. The control data is obtained
    from a stored set of bandwidth-enhanced partials imported from an SDIF
    file using <span class="emphasis"><em>lorisread</em></span> or constructed by another unit generator such as
    <span class="emphasis"><em>lorismorph</em></span>. <span class="emphasis"><em>kfreqenv</em></span> is a control-rate transposition factor: a value
    of 1 incurs no transposition, 1.5 transposes up a perfect fifth, and
    .5 down an octave. <span class="emphasis"><em>kampenv</em></span> is a control-rate scale factor that is
    applied to all partial amplitude envelopes. kbwenv is a control-rate
    scale factor that is applied to all partial bandwidth or noisiness
    envelopes. The bandwidth-enhanced partial data is stored in memory
    with a specified label for future access by another generator.</p>
      </div>
      <div class="refsect1">
        <a id="idp120620432"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the lorisplay opcode. It uses the file <a class="ulink" href="examples/lorisplay.csd" target="_top"><em class="citetitle">lorisplay.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp120622288"></a>
          <p class="title">
            <strong>Example 443. Example of the lorisplay opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac      <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o lorisplay.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1
<span class="comment">; clarinet.sdif can be found in /manual/examples</span>

<span class="comment">; Play the partials in clarinet.sdif from 0 to 3 sec with 1 ms fadetime</span>
<span class="comment">; and no frequency , amplitude, or bandwidth modification.</span>

<span class="oblock">instr</span> 1

ktime	<span class="opc">linseg</span>	  0, p3, 3.0			<span class="comment">; linear time function from 0 to 3 seconds</span>
	lorisread ktime, "clarinet.sdif", 1, 1, 1, 1, .001
kfrq	<span class="op">=</span> p4	<span class="comment">; pitch shifting</span>
asig	lorisplay 1, kfrq, 1, 1
	<span class="opc">outs</span> 	  asig, asig
<span class="oblock">endin</span>

<span class="comment">; Play the partials in clarinet.sdif from 0 to 3 sec with 1 ms fadetime</span>
<span class="comment">; adding tuning and vibrato, increasing the "breathiness" (noisiness) and overall</span>
<span class="comment">; amplitude, and adding a highpass filter.</span>

<span class="oblock">instr</span> 2

ktime	<span class="opc">linseg</span>	0, p3, 3.0			<span class="comment">; linear time function from 0 to 3 seconds</span>
						<span class="comment">; compute frequency scale for tuning</span>
    
ifscale	<span class="op">=</span>	<span class="opc">cpspch</span>(p4)<span class="op">/</span><span class="opc">cpspch</span>(8.08)		<span class="comment">; (original pitch was G#4)</span>
						<span class="comment">; make a vibrato envelope</span>
kvenv	<span class="opc">linseg</span>	0, p3<span class="op">/</span>6, 0, p3<span class="op">/</span>6, .02, p3<span class="op">/</span>3, .02, p3<span class="op">/</span>6, 0, p3<span class="op">/</span>6, 0
kvib	<span class="opc">oscil</span>	kvenv, 4, 1			<span class="comment">; table 1, sinusoid</span>
kbwenv	<span class="opc">linseg</span>	1, p3<span class="op">/</span>6, 1, p3<span class="op">/</span>6, 100, 2<span class="op">*</span>p3<span class="op">/</span>3, 100 <span class="comment">;lots of noise</span>
	lorisread ktime, "clarinet.sdif", 1, 1, 1, 1, .001
a1	lorisplay 1, ifscale<span class="op">+</span>kvib, 2, kbwenv
asig	<span class="opc">atone</span>	a1, 1000			<span class="comment">; highpass filter, cutoff 1000 Hz</span>
	<span class="opc">outs</span>	asig, asig
<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="comment">; a sinusoid </span>
<span class="stamnt">f</span> 1 0 4096 10 1

<span class="stamnt">i</span> 1  0   3  1.2	<span class="comment">; shifted up</span>
<span class="stamnt">i</span> 1  +   1  1.5
<span class="stamnt">i</span> 1  +   6  .5	<span class="comment">; shifted down</span>
<span class="stamnt">s</span>

<span class="comment">;     strt   dur   ptch</span>
<span class="stamnt">i</span> 2      1    3    8.08
<span class="stamnt">i</span> 2      3.5  1    8.04
<span class="stamnt">i</span> 2      4    6    8.00
<span class="stamnt">i</span> 2      4    6    8.07
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp120626576"></a>
        <h2>Credits</h2>
        <p>This implementation of the Loris unit generators was written by Kelly
    Fitz (<a class="ulink" href="mailto:loris@cerlsoundgroup.org" target="_top">loris@cerlsoundgroup.org</a>). It is patterned after a prototype implementation of the
    <span class="emphasis"><em>lorisplay</em></span> unit generator written by Corbin Champion, and based on the
    method of Bandwidth-Enhanced Additive Synthesis and on the sound
    morphing algorithms implemented in the Loris library for sound
    modeling and manipulation. The opcodes were further adapted as a
    plugin for Csound 5 by Michael Gogins.</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="lorismorph.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="loscil.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">lorismorph </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> loscil</td>
        </tr>
      </table>
    </div>
  </body>
</html>
